|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcs4hs11.rsalibrary.RSAMath
public class RSAMath
Constructor Summary | |
---|---|
RSAMath()
Empty constructor. |
Method Summary | |
---|---|
int |
coprime(int x)
Using a java.util.Random number generator, pick a random integer that is coprime to the given input parameter x. |
int |
endecrypt(int msg_or_cipher,
int key,
int c)
Given an integer representing an ASCII character value, encrypt it via the RSA crypto algorithm. |
int |
GCD(int a,
int b)
Computes the GCD of two numbers a and b |
int |
mod_inverse(int base,
int m)
Compute the modular inverse base^-1 % m. |
int |
modulo(int a,
int b,
int c)
Computes Math.mod(Math.pow(a, b), c), for large values of a, b, and c |
int |
totient(int n)
Compute Euler's Totient. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RSAMath()
Method Detail |
---|
public int GCD(int a, int b)
a
- One of the two numbers to compute the GCD onb
- One of the two numbers to compute the GCD on
public int modulo(int a, int b, int c)
a
- The base value a in a^b % cb
- The exponent value b in a^b % cc
- The modulus value c in a^b % c
public int totient(int n)
n
- The number to compute the Totient on
public int coprime(int x)
x
- An integer for which a coprime number is desired.
public int mod_inverse(int base, int m)
base
- The base value for which the modular inverse mod m is desired.m
- The modulo parameter m for which the modular inverse of base mod m is desired.
public int endecrypt(int msg_or_cipher, int key, int c)
msg_or_cipher
- An integer containing the ASCII value to be encrypted or the encrypted integer value to be decrypted back to an ASCII value.key
- The public key or private key value as an integer, as appropriate.c
- The modulo parameter for performing encryption or decryption. This value is part of the public and private key (it is shared between the two!).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |